package it.polimi.digitalstate.webbeans;

import it.polimi.digitalstate.dto.MembershipDTO;
import it.polimi.digitalstate.manager.PartyManagerLocal;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

/**
 *This WebBean, given the parameter (with the POST method) memberid 
 *is able to shows the characteristics of the required member
 *
 */
@ManagedBean(name="memberBean")
@RequestScoped
public class MemberBean {
	@EJB
	private PartyManagerLocal ejb;
	private MembershipDTO member;
	@ManagedProperty("#{param.memberid}")
	private int memberid;


	@PostConstruct
	public void init(){
		setMember(ejb.getMembershipByID(memberid));
	}


	public MembershipDTO getMember() {
		return member;
	}


	public void setMember(MembershipDTO member) {
		this.member = member;
	}


	public int getMemberid() {
		return memberid;
	}


	public void setMemberid(int memberid) {
		this.memberid = memberid;
	}

}

